package Myfunction

import (
	"fmt"

	"github.com/gin-gonic/gin"
)

func Hello1(context *gin.Context) {
	context.HTML(200, "demo02.html", nil)

}

// 定义一个结构体
type User struct {
	Username string `form:"username"`
	Pwd      string `form:"pwd"`
}

func Hello2(context *gin.Context) {

	var user User
	err := context.ShouldBind(&user)
	if err != nil {
		context.String(404, "绑定失败%s", err)
	} else {
		context.String(200, "绑定成功%s", user)
		fmt.Println(user)
	}

}
